#include<iostream>
#include"DoubleLinkedList.h"
#include<time.h>

int main()
{
    std::cout<<"program start"<<std::endl;
    List<int> list; 
    list.push_back(1);
    list.push_back(2);
    list.push_back(3);
    list.push_back(4);
    list.push_back(5);
    std::cout <<list.back()<<std::endl ;
    list.printlist();
    List<int>::iterator ite = find(list,5);
    std::cout <<*ite<<std::endl;
    list.erase(ite);
    //list.back();   
    
    List<int>::iterator ite2 = find(list,5);
    //std::cout <<*ite2<<std::endl;
    
//test complexity
	List<char> clist; 
    clock_t start,end;
    start = clock();
    for(int i=0;i<100000;i++)
    {
	clist.push_back('Z');
    }
    end = clock();
    std::cout<<"time for 10w nodes ="<<double(end-start)/CLOCKS_PER_SEC<<" s"<<std::endl;
    clist.push_back('A');
    clock_t start3,end3;
    start3 = clock();
    find(clist,'A');
    end3 = clock();
    std::cout<<"time find for 10w nodes ="<<double(end3-start3)/CLOCKS_PER_SEC<<" s"<<std::endl;

    
	List<char> clista;
    clock_t start2,end2;
    start2 = clock();
    for(int i=0;i<1000000;i++)
    {
		clista.push_back('Z');
    }
    end2 = clock();
    std::cout<<"time for 100w nodes ="<<double(end2-start2)/CLOCKS_PER_SEC<<" s"<<std::endl;
    clista.push_back('A');
    clock_t start4,end4;
    start4 = clock();
    find(clista,'A');
    end4 = clock();
    std::cout<<"time find for 100w nodes ="<<double(end4-start4)/CLOCKS_PER_SEC<<" s"<<std::endl;

    return 0;
}


